-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Switch TypeApplications to given extensions #23512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I prefer to assume it's yet another spurious test failure.
There is an infrastructure problem with so many recent failures. pc tests are inherently flaky if they are reactive. It would be nice to have tiers of unit tests, functional tests (integration), and liveliness tests that might time out but which would be run in a quiescent environment maybe once a day. |
@@ -2132,6 +2132,9 @@ object Types extends TypeUtils { | |||
/** Is the `hash` of this type the same for all possible sequences of enclosing binders? */ | |||
def hashIsStable: Boolean = true | |||
} | |||
object Type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sure about performance impact here. Do we need the given
? Why can't we put the extension methods directly in object TypeApplications
?
The problem with compiler refactoring is that we have to be super careful not to make things slower. TypeApplications methods are very often called, so it should be ideally obvious that the new scheme is not slower than the old one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the experiment is to understand the difference in current and export in Types (cost is a forwarder) and this pr (extra reference).
The goal was to avoid import TypeApplications.*
everywhere (the first edit) because I'm too lazy to add that everywhere.
So this is also a test of which idiom is optimal. (Maybe importing everywhere is OK, modulo PR delta.)
As a coder, should I have to guess or even benchmark?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is it's notoriously noisy to benchmark the compiler. Every single commit is in the noise but in the aggregate compilation times go up. And it's almost impossible to bring them down again. Many people have tried and failed to move the needle. I had some limited successes that I obtained by spending months of concentrated work.
So when working with the compiler, the guideline has to be: niceties are irrelevant, always pick the idiom that you believe is fastest. The only exception to this rule: you know that you are working on a part of the compiler that is executed only in rare circumstances (e.g. error message reporting). Then you can splurge on niceties. But TypeApplications is potentially hot.
As a point of illustration: See how often we write a :: Nil
instead of List(a)
. It's not because we think it looks better (it doesn't) but it leads to better code.
I'm reminded that this caught my eye because of the bootstrap error on JDK 23.
|
fa9c3cc
to
4da3dd1
Compare
The difference is that value class eliminates the allocation but not the call to the decorator (identity). In
was
The Context is not an arg but a member def here. |
4da3dd1
to
b0ff516
Compare
Testing stack traces will always be brittle. In this case, the stack didn't even change, it was the line number.
This problem is addressed by |
If
Is that a lot of seconds? |
The test wants to force OOM by allocating a good chunk of what's available, but max memory is arbitrarily unconstrained.
The class loader allocates, to see if lambda serialization causes it not to be reclaimed. It could cause unnecessary swapping etc as it asks for more memory from the OS. (Speculating.) So while the test is try to "fail quickly", it could be incurring slow mechanisms that cause it not to complete expeditiously. I don't even recall off the cuff if the test rig is forking here. Partest would fork in the presence of The test does not The test is very close to the Scala 2 test. It can't be run by scala-cli in modern jvm because of the assumption about the class loader.
|
The output says
I'll look at the test separately. (It looks like it's testing a caching feature not implemented in Scala 3.) Worth adding that the github runner experience is pretty nice; in particular, just re-running the failed windows test job. |
Maybe I broke something. On scala 2, I'd previously added to the test
|
Casual refactor to try newer features.